﻿@model IEnumerable<Capstone_20130302.Models.Category>

@{
    ViewBag.Title = "Categories";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<script src="~/Scripts/jquery.dataTables.js"></script>
<script src="~/Scripts/dataTables.bootstrap.js"></script>
<script>
    $(document).ready(function() {
        $('#example').dataTable({
            "sDom": "<'row spare-down'<'span4'f><'span3'l>r>t<'row'<'span3'i><'span8'p>>",
            "sPaginationType": "bootstrap",
            "oLanguage": {
                "sLengthMenu": "_MENU_ records per page"
            }
        });
    })
</script>


<p>
    @Html.ActionLink("Create New", "Create", null, new {@class = "btn pull-right"})
</p>
<table id="example" cellpadding="0" cellspacing="0" border="0" class="display table table-striped table-bordered">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Name)
            </th>
            <th>Parent Category</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody>
    @foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Parent.Name)
            </td>
            <td>
                <a href="Category/Edit/@item.CategoryId"><i class="icon-edit"></i> Edit</a>
                <a href="Category/Id/@item.CategoryId"><i class="icon-search"></i> View</a>
            </td>
        </tr>
    }
    </tbody>
</table>
